#! /bin/bash

proname=`basename $0`
proPath=`dirname $0`
buildPath=`readlink -f ${proPath}/rpm`
goSrcPath=`readlink -f ${proPath}/`
echo "buildPath is "$buildPath
echo "goSrcPath is "$goSrcPath

cd $goSrcPath

go clean
go build -gcflags="-N -l" accx.go
if [ $? -ne 0 ]
then 
	echo "go build error"
	exit -1
else
	echo "go build success"
fi

if [ ! -e accx ];then
	echo "accx is not exist"
	exit 0
fi

#generate hss load information
cd $buildPath
sh generateInfo.sh
if [ -s loadInfo.txt ];then
    echo "generate loadInfo.txt success!"
else
	echo "generate loadInfo.txt failed!"
	exit -1
fi


cd $buildPath
./gen_rpm.sh

	
exit 0
